﻿using System;
using System.Collections.Generic;
using System.Web;
using System.IO;

/// <summary>
/// Summary description for ControlLog
/// </summary>
/// 

namespace ControlLogNamespace
{
    public class ControlLog
    {
        public ControlLog()
        {
        }

        public static void writeLog(string strLogLine)
        {
            try
            {
                // Write the string to a file.
            //Produccion
                   string saveDir = "\\\\hmfsw\\web\\DTCWIN107\\horsejack.com.ar\\public_html\\Logs\\";
              //  string saveDir = "\\\\hmfsw\\web\\DTCWIN155\\mymimportacionesweb.com.ar\\public_html\\Logs\\";
            //Desarrollo    
            //    string saveDir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

                StreamWriter sw = File.AppendText(saveDir + "Log_" + System.DateTime.Now.Day.ToString().PadLeft(2, '0') + System.DateTime.Now.Month.ToString().PadLeft(2, '0') + System.DateTime.Now.Year.ToString() + ".log");

                sw.WriteLine(System.DateTime.Now.ToString() + " - " + strLogLine);
                // Writing a string directly to the file

                sw.Close();
            }
            catch
            {
            }
        }
    }
}